
<%@ page import="rentadomus.Local" %>
<%@ page import="rentadomus.Place" %>  
<!DOCTYPE html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'local.label', default: 'Local')}" />
		<title><g:message code="default.list.label" args="[entityName]" /></title>
	</head>
	<body>
		<a href="#list-local" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
		<div class="nav" role="navigation">
			<ul>
				<li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
				<li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
			</ul>
		</div>
		<div id="list-local" class="content scaffold-list" role="main">
			<h1><g:message code="default.list.label" args="[entityName]" /></h1>
			<g:if test="${flash.message}">
			<div class="message" role="status">${flash.message}</div>
			</g:if>
			<table>
				<thead>
					<tr>
					
                                                <g:sortableColumn property="tittlePlace" title="Title Of place" />
                                                
                                                <g:sortableColumn property="Adress" title="Adress" />
                                                
                                                <g:sortableColumn property="neighborhood" title="Neighborhood" />
                                                
                                                <g:sortableColumn property="area" title="Área" />
                                          
						<g:sortableColumn property="localType" title="${message(code: 'local.localType.label', default: 'Local Type')}" />
                                                
                                                <g:sortableColumn property="managementPrice" title="Rent Price" />
                                                
                                                
					
					</tr>
				</thead>
				<tbody>
                                <g:each in="${Place.findAll(sort: 'date', order:'desc')}" status="i" var="it">
                                    <g:each in="${localInstanceList}" status="k" var="localInstance">
                                      <g:if test="${localInstance.idPlace.id == it.id}">
                                        <g:if test="${filterB=='Area'}">        
                                            <g:if test="${it.area>=Integer.parseInt(valueP) &&
                                                  it.area<=Integer.parseInt(valueP2)}">
                                                <tr class="${(k % 2) == 0 ? 'even' : 'odd'}">

                                                        <td><a href="${createLink(controller:"Local", action:'show', id:localInstance.id)}">${fieldValue(bean: it, field: "titlePlace")}</td>
                                                              
                                                        <td>${fieldValue(bean: it, field: "address")}</td>

                                                        <td>${fieldValue(bean: it, field: "neighborhood")}</td>

                                                        <td>${fieldValue(bean: it, field: "area")} mts^2</td>

                                                       <td> ${fieldValue(bean: localInstance, field: "localType")}</td>

                                                       <td>${fieldValue(bean: it, field: "rentPrice")}</td>

                                                </tr>
                                            </g:if>
                                         </g:if>
                                        <g:if test="${filterB=='Price'}">        
                                            <g:if test="${it.rentPrice>=Double.parseDouble(valueP) &&
                                                  it.rentPrice<=Double.parseDouble(valueP2)}">
                                                <tr class="${(k % 2) == 0 ? 'even' : 'odd'}">

                                                        <td>${fieldValue(bean: it, field: "titlePlace")}</td>
                                                              
                                                        <td>${fieldValue(bean: it, field: "address")}</td>

                                                        <td>${fieldValue(bean: it, field: "neighborhood")}</td>

                                                        <td>${fieldValue(bean: it, field: "area")} mts^2</td>

                                                       <td> ${fieldValue(bean: localInstance, field: "localType")}</td>

                                                       <td>${fieldValue(bean: it, field: "rentPrice")}</td>

                                                </tr>
                                            </g:if>
                                         </g:if>
                                         <g:if test="${filterB=='Neighborhood'}">        
                                            <g:if test="${it.neighborhood==valueP}">
                                               <tr class="${(k % 2) == 0 ? 'even' : 'odd'}">

                                                     <td>${fieldValue(bean: it, field: "titlePlace")}</td>
                                                              
                                                        <td>${fieldValue(bean: it, field: "address")}</td>

                                                        <td>${fieldValue(bean: it, field: "neighborhood")}</td>

                                                        <td>${fieldValue(bean: it, field: "area")} mts^2</td>

                                                       <td> ${fieldValue(bean: localInstance, field: "localType")}</td>

                                                       <td>${fieldValue(bean: it, field: "rentPrice")}</td>
                                              </tr>
                                           </g:if>
                                        </g:if>
                                        <g:if test="${filterB=='Strata'}">
                                           <g:if test="${it.strata==Integer.parseInt(valueP)}">    
                                             <tr class="${(k % 2) == 0 ? 'even' : 'odd'}">

                                                     <td>${fieldValue(bean: it, field: "titlePlace")}</td>
                                                              
                                                        <td>${fieldValue(bean: it, field: "address")}</td>

                                                        <td>${fieldValue(bean: it, field: "neighborhood")}</td>

                                                        <td>${fieldValue(bean: it, field: "area")} mts^2</td>

                                                       <td> ${fieldValue(bean: localInstance, field: "localType")}</td>

                                                       <td>${fieldValue(bean: it, field: "rentPrice")}</td>
                                              </tr>
                                           </g:if>
                                        </g:if>
                                      </g:if>
                                    </g:each>
				</g:each>
				</tbody>
			</table>
			<div class="pagination">
				<g:paginate total="${localInstanceTotal}" />
			</div>
		</div>
             <br><br><br><br>
       
          <a href="/RentADomus/searchByFilters/main/" >
				<fieldset class="buttons">
					<g:submitButton name="Back" class="back" value="Back" />
				</fieldset>
            
          </a>
	</body>
</html>
